<?php if(isset($rows)) :?>

<?php if($rows[0]->senderid == $this->session->userdata('userid')) : ?> 
<p >Between <b><?=$rows[0]->receiver_name?></b> and <b>You</b> </p>
<?php else: ?>
<p >Between <b><?=$rows[0]->sender_name?></b> and <b>You</b> </p>
<?php endif; ?>

<ul data-role="listview" data-inset="true">

<li data-icon="false">
<!--
<?php
		$filename=$rows[0]->avatar_name;
		$gallery_path_url=base_url().'images/thumbs/'.$filename;
		$gallery_path = realpath(APPPATH . '../images/thumbs/');
		$avatar_path=$gallery_path.$filename;
		if(!file_exists($avatar_path)):
		?>
		<img class="top" src="<?=base_url('themes/resources/girl.jpg');?>"/>
		-->
	    <?php endif; ?>
		<h4><?=$rows[0]->sender_name?></h4>
		<p><b><?=$rows[0]->content;?></b></p>
		<p class="ui-li-aside"></p>
		

<?php endif; ?>

</li>
</ul>

<?php


echo form_open('messege_controller/send_messege?receiverid='.(string)($receiverid) );
//echo form_hidden('receiverid',$receiverid);
echo form_textarea('content', set_value('content')) . form_error('content');
echo form_submit('submit', 'send');
echo form_close();

?>

<?php if(isset($rows)) :?>

<h4>  Previous Messages</h4>

<ul data-role="listview" data-inset="true">

<?php for($i = 1 ; $i < sizeof($rows); $i++): ?>

<li data-icon="false">

		
		<!--
		<?php
		$filename=$rows[$i]->avatar_name;
		$gallery_path_url=base_url().'images/thumbs/'.$filename;
		$gallery_path = realpath(APPPATH . '../images/thumbs/');
		$avatar_path=$gallery_path.$filename;
		if(!file_exists($avatar_path)):
		?>
		
		<img class="top" src="<?=base_url('themes/resources/girl.jpg');?>" />
	    <?php endif; ?>
	    -->
	    	
		<h4><?=$rows[$i]->sender_name?></h4>
		<p><b><?=$rows[$i]->content;?></b></p>
		<p class="ui-li-aside"></p>

</li>
<?php endfor;?>

</ul>
<?php else :?>
<h4>There is no new messege now!</h4>
<?php endif; ?>